﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using MF.EFRepository.Entities;
using MF.Data;
using MF.Repository;
using MF.EFRepository;
using MF.ServiceModel;

namespace MF.Services
{
    public interface IOrderService { }

    [DbContextBehavior]
    public class OrderService : IOrderService
    {
        private readonly IOrderRepository orderRepository;
        //not used anymore
        //public OrderService()
        //{
        //    this.orderRepository = IoC.Current.Container.Resolve<IOrderRepository>();
        //}
        public OrderService(IOrderRepository repository)
        {
            this.orderRepository = repository;
        }
        public IEnumerable<Order> ListOrders()
        {
            return orderRepository.Query();
        }
        public IEnumerable<Order> ListOrdersByCustomer(int customerId)
        {
            return orderRepository.QueryByCustomer(customerId);
        }
    }
}
